<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('external_users', function (Blueprint $table) {
            $table->id();
            $table->string('external_id')->comment('用户在外部平台的ID');
            $table->string('name')->comment('用户名');
            $table->string('avatar')->default('')->comment('头像');
            $table->integer('source_id')->comment('所属平台 1 未知平台 2 bili');
            $table->softDeletesTz()->comment('软删字段');
            $table->timestamps();
            $table->index('external_id', 'external_id');
            $table->index('source_id', 'source_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('external_users');
    }
};
